import './base.css'
import {useRef, useState} from "react";

export default function Component(props) {
    const inputRef=useRef()//ref
    const [inputValue,setInputValue]=useState('')
    console.log(props.reciveData,'父组件传递给子组件')
    const sendParent = () => {
        props.rejectParent('子组件传递给父组件')
    }
    const changeInput=(e)=>{
        setInputValue(e.target.value)
    }
    //获取dom
    const getDom=()=>{
        console.log(inputRef.current,'获取dom')
    }
    const firstStep=()=>{
        props.firstStep('第一步成功')
    }
    return (
        <div >
            <div onClick={sendParent} className='title'>模块化</div>
            <input value={inputValue} onChange={(e)=>changeInput(e)} ref={inputRef}></input>
            <button onClick={getDom}>获取dom</button>
            <button onClick={firstStep}>1.兄弟传参</button>
            {/*<div>{props.children}</div>*/}
        </div>
    )
}
